Skip to main content

ViewerObject

The ViewerObject interface, part of the @promaton/scan-viewer package, defines the configuration for loading files or file sequences into the viewer. This interface provides a wide range of properties to customize the behavior, appearance, and interaction of objects within the viewer. Below is a detailed breakdown of its properties.

Properties

clipToPlanes?

  • Type: boolean
  • Clips and outlines the object to the slice plane when viewed orthogonally. Supported only by meshes.

color?

  • Type: string
  • Specifies the color of the object. If the object ID follows the labelDefinition naming standard, the color can be derived automatically.

crossSectionAlongCurve?

  • Type: boolean
  • Enables a custom cross-section view that moves along the shape of the object when selected.

customCreaseAngle?

  • Type: null | number
  • Forces merging geometry with creased normals at a specified angle (in radians). If set to null, geometry is merged without creases. Note: This process may be time-consuming.

customMaterial?

  • Type: CustomViewerMaterial
  • Overrides or overlays the default material with a custom material.

depthOffsetFactor?

  • Type: number
  • Adjusts the polygon position in the depth map. Negative values sort the object below overlapping objects, while positive values sort it above.

depthWrite?

  • Type: boolean
  • Controls whether the object writes to the depth buffer. Defaults to true.

detectOrientation?

  • Type: boolean
  • Enables orientation detection based on mesh topology, useful for aligning cross-sections and axis visualization.

dirty?

  • Type: boolean
  • Indicates whether the object has been edited.

disabled?

  • Type: boolean
  • Disables mouse events for the object.

excludeInOrientations?

  • Type: ViewOrientation[]
  • Excludes the object from views with specified orientations.

excludeInViews?

  • Type: string[]
  • Excludes the object from viewports with specified names.

flatShading?

  • Type: boolean
  • Enables flat shading, preventing normal interpolation within faces.

geometry?

  • Type: BufferGeometry<NormalBufferAttributes>
  • Specifies premade geometry to use instead of the source URL.

group?

  • Type: string
  • Categorizes the object into a group in the LayerList.

hidden?

  • Type: boolean
  • Hides the object in the viewport.

isMetadata?

  • Type: boolean
  • Classifies the file as metadata, preventing it from being rendered.

loadOptions?

  • Type: LoadOptions
  • Customizes the loading behavior of the object.

metalness?

  • Type: number
  • Sets the material's metalness (0 to 1). Higher values make the material darker and more reflective.

objectType?

  • Type: string
  • Specifies the resource type. If unspecified, it is inferred from the URL.

opacity?

  • Type: number
  • Sets the object's opacity. Higher opacity items are prioritized in rendering.

pose?

  • Type: Matrix4
  • Defines the object's intrinsic orientation. Ignored if detectOrientation is enabled.

renderOrder?

  • Type: number
  • Determines the rendering order. Higher values render later, displaying the object on top of overlapping meshes.

renderVolume?

  • Type: boolean
  • Renders a voxel image as a 3D volume in the 3D view (supported for images only).

roughness?

  • Type: number
  • Sets the material's roughness (0 to 1).

showAxis?

  • Type: "x" | "y" | "z"
  • Displays the specified axis in the object's local coordinate system.

showMeshInPanorama?

  • Type: boolean
  • Continues rendering the mesh when the clipping plane intersection outline is visible.

showMeshInSlices?

  • Type: boolean
  • Enables a slice drop-off or ghost effect near the planes.

side?

  • Type: Side
  • Specifies which side of the material to render. Default: DoubleSide.

subGroups?

  • Type: string[]
  • Provides additional categorization for the object.

transform?

  • Type: Matrix4
  • Applies a transformation matrix to the object.

url

  • Type: string | string[]
  • Specifies the URL(s) pointing to the resource(s). A list can be used for image sequences.

vertexColors?

  • Type: boolean
  • Displays vertex colors when available. Defaults to true for PLY and VTK formats, and false otherwise.

This interface provides extensive customization options for objects in the viewer, making it a powerful tool for rendering and interacting with 3D content.